home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
editor
/
isohtml.lha
/
isohtml
/
cvt.doc
< prev
next >
Wrap
Text File
|
1995-08-07
|
10KB
|
213 lines
CV/CVT -*- Text -*-
NAME
cvt - file converter command
SYNOPSIS
cvt [options] [-f rulefile] [-o outfile] [@] [infiles]
DESCRIPTION
Cvt converts given input files `infiles' to `outfile' using the
conversion rules given in `rulefile'.
The input and output filenames are optional. If not specified
Cvt will use the standard input and/or output streams.
If no rulefile is specified or if the rulefiles is empty cvt will
print a warning and copy the input data to the output stream
without changing anything. Please note that the `-f' option
is allowed to appear only once in the command line. This avoids
confusion with option keyword precedence and similar things.
Input and output filename can be the same. Cvt will always make
use of a temporary file when not writing to stdout. The output
filename can be given relative to the input filename by using
one `%s' construct in the ouput filename specification. The first
occurence of `%s' will be replaced by the input filename.
A constant output filename makes no sense with more than one input
file because cvt would replace this file each time a new input file
is converted.
White spaces between the option keywords and their values are
optional, i.e. `-ofile' and `-o file' are both legal, concatenation
of option keywords however is not: -nx and -n -x result in a quite
different behaviour.
Further options are:
-c n Sets the #of characters in local charset to n.
(default is -c256)
-E file Directs error messages (e.g. from the rulefile scanner)
to `file' instead of the standard error stream 'stderr'.
Usefull for batchfiles together with `-n'.
-e n Sets the #of errors until the scanner aborts scanning
rules. (default is -e5)
-l file Cvt will take the input filenames from a file.
Filenames in such a file must be seperated by white
characters and can be quoted with double quotes `"'.
There can be no further options in such files.
-n Cvt tries to parse all rules but won't convert anything.
Usefull to check conversion scripts (rulefiles).
If no `-f' option is given cvt will treat the intput
files as script files and tries to parse them respectively.
The explicit use of the `-f' keyword however makes cvt
check only the script file. Input filenames (if any)
are ignored then.
-t file Sets the filename for the temporary output to 'file'.
This file will also be used when converting to stdout.
(Cvt would normally not write to a temporary file when
converting to stdout)
-x Cvt checks the existance of all input filenames specified
after (right of) this option before the conversion begins.
A rulefile is a textfile conataining zero or more rules of the
form
lhs -> rhs ;
with lhs and rhs being the left hand side and right hand side of
a conversion rule.
The lhs holds 1 or more character codes which (if found in the
input stream) will be transformed to those in the rhs. Lhs and
rhs don't need to be of equal length. The rhs may even be empty
if all appearences of the lhs should be removed from the input.
Neither lhs nor rhs nor the number of rules is limited by cvt.
Character codes are positive interger values in [0..C-1] with C
being the #of characters in the local charset (normally 256).
This value can be changed with the `-c' option in the command
line. Character codes can be in decimal, hexadeximal or octal
notation. Hex numbers must have a leading dollar sign `$', octal
numbers must have a leading zero `0'.
Warning: A common mistake is to write decimal numbers with a
leading `0'. This is only correct for numbers <= 7.
Character codes can be concatenated using commata `,'. In addition
to the numeric character code values the lhs and rhs can contain
strings. A string is a sequence of zero or more characters between
opening and closing double quotes `"'. A string may contain
special escape sequences using the backslash `\' as an escape
character
\n newline NL (LF)
\t horizontal tab HT
\v vertical tab VT
\b backspace BS
\r carriage return CR
\f form feed FF
\a alert BEL
\\ backslash \
\? question mark ?
\' single quote '
\" double quotes "
\0 integer 0 NUL
\ooo octal number ooo
\xhhh hex number hhh
Strings are also concatenated by commata. A concatenation between
strings and numeric character codes is allowed. A cvt string has
no terminating null character.
Warning: A common mistake is to assume that there is no need for
a comma in a concatenation of strings because it isn't needed in C
code. Cvt however needs a comma to concatenate strings.
A rule ends with a semicolon `;'. There can be several rules in
one line and one rule can be split across several lines. There
can even be comments inside of a rule.
Cvt supports both C and C++ like comments. A comment in C begins
with a slash `/' followed by an asterisk `*' and ends with a `*/'.
Nested comments are not allowed, i.e. a `*/' can not be inside
or part of a comment. A comment in C++ (also called remark here)
begins with two slashes `//' and ends with the end of the line they
appear in.
NOTES
Cvt will not check the existance of the output file.
If it exists cvt will blow it away without asking you. Cvt also
assumes the existance of all dircetories in the output path.
Cvt can take the path to your conversion script files out of
the environment variable CVSCRIPTS. If the given rulefile
is not present relative to the current directory cvt will
prepend the pathname in CVTSCRIPTS to the given rulefile.
It is legal to assign CVSCRIPTS several pathnames seperated by
semicolons `;'. Cvt will scan CVSCRIPTS from left to right.
Trailing slashes are optional.
There is a difference in the use of filenames and the use of
redirectioning (or piping). It is of course absolutely legal to
pipe your data through cvt but you should be aware of the fact that
the standard input and output streams are often non-binary streams
and might change or even corrupt your data before it reaches cvt.
The files opened by cvt are read and written in binary mode.
It is not possible to replace a file using the pipe or
redirectioning because the use of '>' in your command line deletes
the destination file before cvt sees a byte of it.
The values of escaped character constants in a string and the
number of digits needed to express them are limited to the local
charset size. There will be no warning for a string like
"\x100"
in a charset with character codes in [$00..$FF]. Cvt reads in this
case
$10,"0"
which is absolutely okay. The same applies to octal character codes
in strings.
Not only the value but also the number of digits is limited. This
allows you to write a literal digit after an escaped character
code as in
"\0077"
which will be interpreted as
07,"7"
in a charset where 3 octal digits are needed to express all
available character codes. It is wise then always to use three
digits for the number when embedding a numeric constant in
a string using octal noatation. The notation is hard enough to
read without having to worry about whether the character after a
constant is a digit or not.
It is allowed to break a rule into several lines to make the
text neater. (There is no limit for the width of a line and so
there is no other reason why one could feel like breaking lines.)
It is however not allowed to break strings or the derivation
token `->'.
DISTRIBUTION
This version of CVT is NOT in the PUBLIC DOMAIN. You can however
freely distribute it as long as the following is observed:
- The program and documentation must be distributed together and
may not be modified in any way. The only exception is that the
program and documentation may be compressed into an archive for
uploading to Bulletin Boards or for other electronic transmission.
- The program is not to be used commercially or included in a
commercial package for profit unless written authorisation from
me is obtained first.
This version of CVT may be freely included on public domain library
disks or compilation disks provided only a small fee is charged for
the service.
AUTHOR
Tobias Ferber, <ferber@rpk.mach.uni-karlsruhe.de>